package com.luguokong.pet_rescue.service;

import com.luguokong.pet_rescue.mapper.CommentMapper;
import com.luguokong.pet_rescue.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentService {

    @Autowired
    private CommentMapper commentMapper;

    public int insertComment(Comment comment){
        int i = commentMapper.insertComment(comment);
        return i;
    }
    public int deleteCommentById(int cmt_id){
        int i = commentMapper.deleteCommentById(cmt_id);
        return i;
    }
    public List<Comment> selectCommentAllByReplyId(int reply_id){
        List<Comment> commentList = commentMapper.selectCommentAllByReplyId(reply_id);
        return commentList;
    }
    public List<Comment> selectCommentAll(){
        List<Comment> commentList = commentMapper.selectCommentAll();
        return commentList;
    }

    public List<Comment> selectCommentAllByPageNumByPageSize(int pageNum, int pageSize){
        List<Comment> commentList = commentMapper.selectCommentAllByPageNumByPageSize(pageNum, pageSize);
        return commentList;
    }

    public int selectDataCount(){
        int i = commentMapper.selectDataCount();
        return i;
    }

    public int deleteCommentByCmtIdArray(int [] cmtIdArr){
        int i = commentMapper.deleteCommentByCmtIdArray(cmtIdArr);
        return i;
    }
}
